function printEven() {
    // Q1.1
    var arr=[];
    var html ='';

    for (var i=0;i<10;i++){
        arr.push(i*2);
    }

    for (var key in arr){
        html+=arr[key]+"\t";
    }

    document.write(html);
    document.write("<br/>")



    //Q1.2
    var result=arr.filter(function (item) {
        return item%4==0;
    })

    html="";
    for (var key in result){
        html+=result[key]+"\t";
    }

    document.write(html)
}


/*第二题*/
function question2_1() {

    var emp1 ={
         name:'L',
         age:34,
         gender:'female'
    }

    var emp2 ={
        name:'T',
        age:23,
        gender:'male'
    }

    var emp3 ={
        name:'TT',
        age:34,
        gender:'female'
    }

    var emps = [];
    emps.push(emp1);
    emps.push(emp2);
    emps.push(emp3);

    for (var key in emps){
        print(emps[key]);
    }
   function print (emp) {
        document.write("my name is "+emp.name+"<br/>");

    }

}


function question2_2() {

    function Employee(name,age,gender) {
        this.name = name;
        this.age=age;
        this.gender=gender;
        this.print=function () {
            document.write("my name is " + this.name + "<br/>");
            document.write("my gender is " + this.gender + "<br/>");
        }
    }

    var emps = [];
    var emp1 = new Employee('Lee',23,'male');
    var emp2 = new Employee('Mary',23,'female');
    var emp3 = new Employee('Martin',23,'male');

    emps.push(emp1);
    emps.push(emp2);
    emps.push(emp3);

    for (var key in emps){
        emps[key].print();
    }
}